/**
 * 
 */
package cc.w3d.jawos.apps.artiks.client.widgets;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;

public class ToolBarButton extends Button
{
	private ToolBar toolBar;
	private String w = null;

	public ToolBarButton()
		{setPixelSize(18, 18);}

	public ToolBarButton(String html)
	{
		setHTML(html);
		setPixelSize(18, 18);
	}

	public ToolBarButton(String html, ClickHandler handler)
	{
		setHTML(html);
		addClickHandler(handler);
		setPixelSize(18, 18);
	}

	@Override
	public void setText(String text)
	{
		super.setText(text);
		setHTML(super.getText());
	}

	@Override
	public void setHTML(String html)
		{super.setHTML("<div style='position:relative; top:-5'>" + html + "</div>");}

	@Override
	public void setWidth(String width)
	{
		super.setWidth(width);
		if(toolBar == null)
			w = width;
		else
			toolBar.toolBar.setCellWidth(this, width);
	}

	void setToolBar(ToolBar toolBar)
	{
		this.toolBar = toolBar;
		if(w != null)
			toolBar.toolBar.setCellWidth(this, w);
	}
}